package Kuaishou;

import java.util.function.Function;

/**
 * @author leiwenkang <leiwenkang@kuaishou.com>
 * Created on 2021-04-20
 */
public class Test38apply {
    public static void main(String[] args){
        Test38apply functionTest = new Test38apply();
        // return e + 5;就是apply方法的具体实现
        Function<Integer, String> func = e -> {return String.valueOf(e + 6);};
        String result = functionTest.calculate(5, func);
        System.out.println(result);
    }

    public String calculate(Integer a, Function<Integer, String> function) {
        return function.apply(a);
    }
}
